<?php namespace App\Controllers;
use \App\Andy\Andymodel;
use \Forms\Form1;
use \App\Andy\BlogModel;
use CodeIgniter\I18n\Time;



class Home extends BaseController


{
	
protected $theTitle;
protected $theBlog;	
protected $date;	
protected $myDate;
protected $myTime;

				 public function __construct() 
				    {
								parent::__construct();
						  $this->myTime = parent::getTime();
						$this->myDate= date("d/m/Y",$this->myTime); 	
					
			       }
	
	
	
	public function Index()
	{
		
		
	



		
	//	$this->cachePage(DAY);
		//got above from foundations book
		
		$data = [
                'title'  => 'home page ',
                'date'=>$this->myDate
		];
		
		
       echo view('home',$data);
      
		
	}
	
	public function oldIndex()
	
	{
	 $handle = new BlogModel();
	    $result= $handle->isEmpty();
	    
	    if ($result==NULL)
	    {
	   $data = [
                'title'  => 'landing pages',
		];
		
		 echo view('header', $data);
        echo view('home2');
        echo view('footer');	
		   
	    }
	
	
	else{
	
	 $handle = new BlogModel();
	  $result=$handle->getSome();
	  $one=$handle->getOne();
	  $date=     date("d-m-Y ");
	  
	  
	
	
	
	$data = [
                'title'  => 'landing page ss',
               //'result2'=>$resultr_dum
	       //above works
	       'result1'=>$one,
	       'result2'=>$result,
	       'date'=>$date
	       
	       
	       
	       
        ];

        echo view('header', $data);
        echo view('home', $data);
        echo view('footer',$data);	
	
	
	
	
	
	}
	}
   public function some()
   {
	 
	 
	 $handle = new BlogModel();
	  $result=$handle->getSome();
	  
	  foreach ($result as $stuff)
	  
	  {
	  
	  echo $stuff['title'];
	  
	  }
	  
	  
	   
	echo "i am home controller, function some";
	 
	
	}   
       
       
       
	public function test()

	{
	echo "hello";
	echo "<br><br>";	
	echo "fcpath is  :".FCPATH;
	}
		

      
   public function getMail()
   
   {
	
	
	
	 echo "you have mail";
	 
	$name=  $this->request->getVar('name');
	 echo $name;
   }







}
